package org.lwj.Intercepts.crypt.impl;


import org.lwj.Intercepts.crypt.ICrypt;

import java.nio.charset.StandardCharsets;
import java.util.Base64;

public class Base64CryptImpl implements ICrypt {
    @Override
    public String encrypt(String plain) {
        return Base64.getEncoder().encodeToString(plain.getBytes(StandardCharsets.UTF_8));
    }

    @Override
    public String decrypt(String cipher) {
        return new String(Base64.getDecoder().decode(cipher), StandardCharsets.UTF_8);
    }
}
